<?php
	require_once "conn.php";
	if(!empty($_POST['username']))
		{
							
			$sql1="select id from users where 账号='".$_POST['username']."' and 密码='".$_POST['password']."'";
			$result1 = $conn->query($sql1);
			if($result1->num_rows > 0)
				{
					$row = mysqli_fetch_assoc( $result1 );
					$expire=time()+60*60*24;
					setcookie("user", $_POST['username'], $expire,"/");
					setcookie("user_id", $row['id'], $expire,"/");
					header('Location:/index.php');
					
				}else
				{
					header('Location:/login.php');
				}		
				
		}
?>